//
//  ChatRecordCell.m
//  WanCaiC8
//
//  Created by tangang on 2018/4/12.
//  Copyright © 2018年 tangang. All rights reserved.
//

#import "ChatRecordCell.h"

@implementation ChatRecordCell{
    QXLable     *labTitle;
    QXLable     *labTime;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        WS(weakSelf);
        self.selectionStyle=UITableViewCellSeparatorStyleNone;
        labTitle=[[QXLable alloc]init];
        labTitle.textColor=DEFAULTTEXTGDARKRAYCOLOR;
        [self.contentView addSubview:labTitle];
        [labTitle mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(weakSelf.contentView).with.offset(10);
            make.centerY.equalTo(weakSelf.contentView);
            make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH-80, 30));
        }];
        
        labTime=[[QXLable alloc]init];
        labTime.textAlignment=NSTextAlignmentRight;
        labTime.textColor=DEFAULTTEXTGDARKRAYCOLOR;
        [self.contentView addSubview:labTime];
        [labTime mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(weakSelf.contentView).with.offset(-10);
            make.centerY.equalTo(weakSelf.contentView);
            make.size.mas_equalTo(CGSizeMake(80, 30));
        }];
        
        UIView  *line=[[UIView alloc]init];
        line.backgroundColor=DEFAULTBGCOLOR;
        [self.contentView addSubview:line];
        [line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.top.equalTo(weakSelf.contentView);
            make.left.equalTo(labTitle);
            make.height.mas_equalTo(@.7);
        }];
    }
    return self;
}

- (void)setModel:(ChatRecordModel *)model{
    labTitle.text=model.Message;
    labTime.text=model.Time;
}

@end
